package com.cph.schedule;

import com.cph.es.controller.AddVehicleCarDataController;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class InsertVehicleCarToEs {

    @Autowired
    private AddVehicleCarDataController addVehicleCarDataController;

    @Scheduled(cron = "0/5 * * * * ? ")//每5秒执行一次
    /**
     * 生成过车数据并存入es
     */
    public void sync() {
        log.info("InsertVehicleCarToEs sync start!");
        addVehicleCarDataController.createVehicleCarData();
    }

}
